package com.accp.demo.controller.finance;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.accp.demo.pojo.finance.Payment;
import com.accp.demo.pojo.finance.PaymentContent;
import com.accp.demo.pojo.finance.PaymentTakePrepay;
import com.accp.demo.service.finance.PaymentService;

@RestController
@RequestMapping("/paymentController/")
public class PaymentController {
	
	@Autowired
	private PaymentService iPaymentService;
	
	
	//
	@RequestMapping("addpayment")
	@ResponseBody
	public void savepayment(){
		System.out.println("==========================");
		Payment aa=new Payment("1","株洲新良");
		aa.getPaymentContents().add(new PaymentContent(5,"1"));
		aa.getPaymentTakePrepays().add(new PaymentTakePrepay(5));
		//aa.getPaymentContents.add(new PaymentContent(5,"dasd"));
		iPaymentService.savePayment(aa);
	}
	
	//
	@RequestMapping("updatepayment")
	@ResponseBody
	public void updatepayment(){
		Payment aa=new Payment("1","株洲新良1fdr11");
		aa.getPaymentContents().add(new PaymentContent(3,"1",1));
		aa.getPaymentTakePrepays().add(new PaymentTakePrepay(3,"1","jhj"));
		//aa.getPaymentContents.add(new PaymentContent(5,"dasd"));
		iPaymentService.updatePayment(aa);
		
	}
}
